import axios from '@/libs/api.request'
import {getFullUrl} from '../config'

let getUrl = getFullUrl('user')

//--------------------------------------GET
// 获取所有项目类型
export const listType = () => {
  return axios.request({
    url: getUrl('/type?type=1'),
    method: 'GET'
  })
}


//--------------------------------------POST

// 添加项目类型
export const addType = (type) => {
  return axios.request({
    url: getUrl('/type'),
    method: 'POST',
    data: type
  })
}


//--------------------------------------PATCH

// 更新项目类型
export const updateType = (type) => {
  return axios.request({
    url: getUrl('/type'),
    method: 'PUT',
    data: type
  })
}

//--------------------------------------DELETE

// 删除项目类型
export const removeType = (typeId) => {
  return axios.request({
    url: getUrl('/type/' + typeId),
    method: 'DELETE'
  })
}
